package com.fare.taluo.core.domain.crawl;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;

import com.dayatang.domain.InstanceFactory;
import com.fare.taluo.base.ddd.domain.baseentity.BaseEntity;

/**
 * 抓取统计持久化日志
 * 
*/
@javax.persistence.Table(name="fdc_persistent_recorde")
@javax.persistence.Entity
public class PersistentRecordeEntity extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Column(name="create_time")
	private Date createTime;
	
	@Column(name ="task_start_time")
	private Date startTime;
	
	@Column(name ="task_end_time")
	private Date endTime;
	
	@Column(name ="task_log")
	private String taskLog;
	
	@Column(name ="next_time")
	private Date nextTime;
	
	@Column(name ="this_do_grab_date")
	private Date finishedGrabDate;
	
	@Column(name ="next_do_grab_date")
	private Date nextDoGrabDate;
	
	@Column(name ="frequency")
	private Integer frequency;
	
	@Column(name ="status")
	private Integer status;
	
	public static PersistentRecordeEntityRepository getEntityRepository() {
			return InstanceFactory.getInstance(PersistentRecordeEntityRepository.class);
	}
	
	// 增加or更新
	public void saveOrUpdateUserCareLineEntity(PersistentRecordeEntity entity) {
		if(entity.getId() ==null || entity.getId() <=0){
			getEntityRepository().save(entity);
		}else{
			getEntityRepository().updateVO(entity);
		}
		
	}
	// 删除
	public void remove() {
		getEntityRepository().remove(this);
	}
	// 查找
	public List<PersistentRecordeEntity> findAll(){
		return getEntityRepository().findAll();
	}
	public List<PersistentRecordeEntity> findByGrabDate(Date grabDate) {
		return getEntityRepository().findByGrabDate(grabDate);
	}
	

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getTaskLog() {
		return taskLog;
	}

	public void setTaskLog(String taskLog) {
		this.taskLog = taskLog;
	}

	public Date getNextTime() {
		return nextTime;
	}

	public void setNextTime(Date nextTime) {
		this.nextTime = nextTime;
	}

	public Date getFinishedGrabDate() {
		return finishedGrabDate;
	}

	public void setFinishedGrabDate(Date finishedGrabDate) {
		this.finishedGrabDate = finishedGrabDate;
	}

	public Date getNextDoGrabDate() {
		return nextDoGrabDate;
	}

	public void setNextDoGrabDate(Date nextDoGrabDate) {
		this.nextDoGrabDate = nextDoGrabDate;
	}

	public Integer getFrequency() {
		return frequency;
	}

	public void setFrequency(Integer frequency) {
		this.frequency = frequency;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

}
